<?php

$html = '<div class="bookProfile"><h2>Добавяне на книги</h2></div>';
$html .= '<form method="POST" action="index.php?p=new-book">
    <div>
        Име на книгата:<input type="text" name="book_title" />
        <input type = "submit" value = "Добави"/>
    </div>
    <div>Автори:</div>
    <div>';
$html .= '<select multiple name="authors[]">';
foreach ($data['authors'] as $author) {
    $html .= '<option value = "' . $author['id'] . '">' . htmlspecialchars($author['name']) . '</option>';
}
$html .= '</select>';

foreach ($data['errors'] as $error) {
        $html .= '<p class="error">' . $error . '</p>';
    }

echo $html;